﻿using InSimDotNet.Packets;

namespace LFSRecord2.Model.Replay
{
    public class CompCarCustom
    {
        /// <summary>
        /// Current path node
        /// </summary>
        public ushort Node { get; private set; }

        /// <summary>
        /// Current lap
        /// </summary>
        public ushort Lap { get; private set; }

        /// <summary>
        /// Player's unique id
        /// </summary>
        public ushort PLID { get; private set; }

        /// <summary>
        /// Current race position : 0 = unknown, 1 = leader, etc...
        /// </summary>
        public ushort Position { get; private set; }

        /// <summary>
        /// Flags and other info
        /// </summary>
        public CompCarFlags Info { get; private set; }

        /// <summary>
        /// X map (65536 = 1 metre)
        /// </summary>
        public int X { get; private set; }

        /// <summary>
        /// Y map (65536 = 1 metre)
        /// </summary>
        public int Y { get; private set; }

        /// <summary>
        /// Z alt (65536 = 1 metre)
        /// </summary>
        public int Z { get; private set; }

        /// <summary>
        /// Speed (32768 = 100 m/s)
        /// </summary>
        public ushort Speed { get; private set; }

        /// <summary>
        /// Direction of car's motion : 0 = world y direction, 32768 = 180 deg
        /// </summary>
        public ushort Direction { get; private set; }

        /// <summary>
        /// Direction of forward axis : 0 = world y direction, 32768 = 180 deg
        /// </summary>
        public ushort Heading { get; private set; }

        /// <summary>
        /// Signed, rate of change of heading : (16384 = 360 deg/s)
        /// </summary>
        public short AngVel { get; private set; }

        public CompCarCustom()
        {
        }

        public CompCarCustom(CompCar cc)
        {
            Node = (ushort)cc.Node;
            Lap = (ushort)cc.Lap;
            PLID = (ushort)cc.PLID;
            Position = (ushort)cc.Position;
            Info = cc.Info;
            X = cc.X;
            Y = cc.Y;
            Z = cc.Z;
            Speed = (ushort)cc.Speed;
            Direction = (ushort)cc.Direction;
            Heading = (ushort)cc.Heading;
            AngVel = (short)cc.AngVel;
        }
    }
}
